<!DOCTYPE html>
<html>
  <body>

    <script type="text/javascript">

      function ClassA(sColor) {
          this.color = sColor;
          this.sayColor = function () {
              alert(this.color);
          };
      }

      function ClassB() {
      }

      ClassB.prototype = new ClassA();

      ClassB.prototype.name = "";
      ClassB.prototype.sayName = function () {
          alert(this.name);
      };

      var objA = new ClassA();
      var objB = new ClassB();
      objA.color = "blue";
      objB.color = "red";
      objB.name = "John";
      objA.sayColor();
      objB.sayColor();
      objB.sayName();

    </script>

  </body>

</html>
